﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using VietImage.Models;

namespace VietImage.Controllers
{
    public class SearchController : Controller
    {
        //
        // GET: /Search/

        public ActionResult Index(String txtSearch)
        {
            ViewData["SearchType"] = "s";
            CreateViewData(txtSearch);
            //object result = Image.GetImage(new Dictionary<String, System.Object>(), new Dictionary<String, bool>(), false);
            List<Models.Image> lst = new List<Image>();
            return View(lst);
        }

        public ActionResult Advanced(String txtImgName = "", String txtCreatedTime = "", String txtAuthor = "", String txtCategory = "", String txtCountry = "", String txtCity = "", bool sImgName = false, bool sCreatedTime = false, bool sAuthor = false, bool sCategory = false, bool sCountry = false, bool sCity = false)
        {
            CreateViewData("", txtImgName, txtCreatedTime, txtAuthor, txtCategory, txtCountry, txtCity, sImgName, sCreatedTime, sAuthor, sCategory, sCountry, sCity);
            ViewData["SearchType"] = "a";
            List<Models.Image> lst = new List<Image>();
            return View("Index", lst);
        }

        private void CreateViewData(String txtSearch = "", String txtImgName = "", String txtCreatedTime = "", String txtAuthor = "", String txtCategory = "", String txtCountry = "", String txtCity = "", bool sImgName = false, bool sCreatedTime = false, bool sAuthor = false, bool sCategory = false, bool sCountry = false, bool sCity = false)
        {
            ViewData["Keyword"] = txtSearch;
            ViewData["sImgName"] = sImgName;
            ViewData["sCreatedTime"] = sCreatedTime;
            ViewData["sAuthor"] = sAuthor;
            ViewData["sCategory"] = sCategory;
            ViewData["sCountry"] = sCountry;
            ViewData["sCity"] = sCity;
            ViewData["ImgName"] = txtImgName;
            ViewData["CreatedTime"] = txtCreatedTime;
            ViewData["Author"] = txtAuthor;
            ViewData["Category"] = txtCategory;
            ViewData["Country"] = txtCountry;
            ViewData["City"] = txtCity;
        }
    }
}
